home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / idioms.lha / idioms / 5-2.c < prev    next >
C/C++ Source or Header  |  1993-08-08  |  1KB  |  51 lines

  1. /* Copyright (c) 1992 by AT&T Bell Laboratories. */
  2. /* Advanced C++ Programming Styles and Idioms */
  3. /* James O. Coplien */
  4. /* All rights reserved. */
  5.  
  6. class Telephone {
  7. public:
  8.     void ring();
  9.     Bool isOnHook() isTalking(), isDialing();
  10.     DigitString collectDigits();
  11.     LineNumber extension();
  12.     ~Telephone();
  13. protected:
  14.     Telephone();
  15.     LineNumber extensionData;
  16. };
  17.  
  18. class POTSPhone : public Telephone {
  19. public:
  20.     Bool runDiagnostics();
  21.     POTSPhone();
  22.     POTSPhone(POTSPhone&);
  23.     ~POTSPhone();
  24. private:
  25.     Frame frameNumberVal;
  26.     Rack rackNumberVal;
  27.     Pair pairVal;
  28. };
  29.  
  30. class ISDNPhone : public Telephone {
  31. public:
  32.     ISDNPhone();
  33.     ISDNPhone(ISDNPhone&);
  34.     ~ISDNPhone();
  35.     void sendBPacket(), sendDPacket();
  36. private:
  37.     Channel b1, b2, d;
  38. };
  39.  
  40. class OperatorPhone : public ISDNPhone {
  41. public:
  42.     OperatorPhone();
  43.     OperatorPhone(OperatorPhone&);
  44.     ~OperatorPhone();
  45.     void ring();    // special ringing needed for operator
  46. };
  47.  
  48. class PrincessPhone : public POTSPhone {
  49.     . . . .
  50. };
  51.